package tryCatchTest.orderTest;

public class TryCatchFianllyTest {

	public static void order1(int a)
	{
		try
		{
			System.out.println("进入try块");
			if(a<0)
				throw new IllegalArgumentException("参数a不能小于0");
		}

		//捕获IllegalArgumentException异常
		catch(IndexOutOfBoundsException ex)
		{
			System.out.println("进入IllegalArgumentException对应的catch块");
		}

		//捕获除IndexOutOfBoundsException以外的异常
		catch(Exception ex)
		{
			System.out.println("进入catch块");
		}

		//方法程序退出前finally块
		finally
		{
			System.out.println("进入finally块");
		}
	}

	public static void main(String[] args) {
		order1(-1);
		System.out.println("******************");
		order1(1);
	}

}
